# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: GPP <gergan@gmail.com>

_cpan=Test-Most
pkgname=perl-${_cpan,,}
pkgver=0.38
pkgrel=2
pkgdesc='Most commonly needed test functions and features'
arch=(any)
url="https://metacpan.org/release/$_cpan"
license=(GPL PerlArtistic)
_perldeps=(exception-class
           test-deep
           test-differences
           test-exception
           test-warn)
depends=(perl
         "${_perldeps[@]/#/perl-}")
options=(!emptydirs)
_archive="$_cpan-$pkgver"
source=("https://cpan.perl.org/modules/by-module/${_cpan%-*}/$_archive.tar.gz")
sha256sums=('089eb894f7bace4c37c6334e0e290eb20338ee10223af0c82cbe7281c78382df')

build() {
	cd "$_archive"
	unset PERL5LIB PERL_MM_OPT PERL_LOCAL_LIB_ROOT
	export PERL_MM_USE_DEFAULT=1 PERL_AUTOINSTALL=--skipdeps
	perl Makefile.PL
	make
}

check() {
	cd "$_archive"
	unset PERL5LIB PERL_MM_OPT PERL_LOCAL_LIB_ROOT
	export PERL_MM_USE_DEFAULT=1
	make test
}

package() {
	cd "$_archive"
	unset PERL5LIB PERL_MM_OPT PERL_LOCAL_LIB_ROOT
	make install INSTALLDIRS=vendor DESTDIR="$pkgdir"
}
